package com.edevp.modules.user.service.impl;

import com.edevp.modules.user.dto.UserInfoDTO;
import com.edevp.modules.user.service.UserService;
import org.springframework.stereotype.Service;

/**
 * @author edevp
 */
@Service
public class UserServiceImpl implements UserService {
    @Override
    public UserInfoDTO queryById(String id) throws InterruptedException {
        UserInfoDTO userInfoDTO = new UserInfoDTO();
        userInfoDTO.setId(id);
        if("1".equals(id)){
            // 休眠，触发熔断
            Thread.sleep(60);
        }else if("2".equals(id)){
            throw new RuntimeException("故意出错，触发熔断");
        }
        return userInfoDTO;
    }
}
